import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class text178 {
    /*public static void main(String[] args) {
        BlockingQueue<Integer>blockingQueue=new LinkedBlockingQueue<>();
        Thread producer =new Thread(()->
        {
            int count=0;
            while(true)
            {
                try {
                    blockingQueue.put(count);
                    System.out.println("生产者:"+count);
                    count++;
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                //count++;
            }

        });
        Thread consumer=new Thread(()->{
            while(true)
            {
                try {
                    Integer c=blockingQueue.take();
                    System.out.println("消费者:"+c);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

                //System.out.println(c);
            }

        });
        producer.start();
        consumer.start();
    }


    public static void main3(String[] args) throws InterruptedException{
        BlockingQueue<Integer> blockingQueue = new LinkedBlockingQueue<>();
        blockingQueue.put(1);
        //blockingQueue.put(2);
        Integer a=blockingQueue.take();
        System.out.println(a);
        Integer b=blockingQueue.take();
        System.out.println(b);

    }

     */
}
